/**
* <p>Title: User.java</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2013</p>
* @author majintao
* @date 2013-1-30
* @version 1.0
*/
package entity;
import java.util.Date;
import javax.persistence.*;

import java.util.List;
import java.util.ArrayList;

@Entity
@Table(name = "t_user")
public class User {
	private Integer id;
	private String userName;
	private String passWord;
	private String passWord_md5;
	private String email;
	private String qq;
	private String phone;
	private String image;
	private Date createTime;
	private List<Note> notes = new ArrayList<Note>();
	private List<Schedule> schedules = new ArrayList<Schedule>();
	private List<Dir> dirs = new ArrayList<Dir>();
	
    @Id
    @GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Column(name = "username")
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	@Transient
	public String getPassWord() {
		return passWord;
	}
	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}
	@Column(name = "password_md5")
	public String getPassWord_md5() {
		return passWord_md5;
	}
	public void setPassWord_md5(String passWord_md5) {
		this.passWord_md5 = passWord_md5;
	}
	
	@Column(name = "email")
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	@Column(name = "qq")
	public String getQq() {
		return qq;
	}
	public void setQq(String qq) {
		this.qq = qq;
	}
	@Column(name = "phone")
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	@Column(name = "image")
	public String getImage() {
		return image;
	}
	public void setImage(String image) {
		this.image = image;
	}
	@Temporal(TemporalType.DATE)
	@Column(name = "createtime")
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY,mappedBy="user")
	public List<Schedule> getSchedules() {
		return schedules;
	}
	public void setSchedules(List<Schedule> schedules) {
		this.schedules = schedules;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY,mappedBy="user")
	public List<Note> getNotes() {
		return notes;
	}
	public void setNotes(List<Note> notes) {
		this.notes = notes;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY,mappedBy="user")
	public List<Dir> getDirs() {
		return dirs;
	}
	public void setDirs(List<Dir> dirs) {
		this.dirs = dirs;
	}
	
}
